<?php namespace Phpcmf\Controllers;

// 登录跳转
class Go extends \Phpcmf\Common {

    // 从微信菜单中进入授权
    public function index() {

        $url = (!$this->is_mobile ? SITE_URL : SITE_MURL).'index.php?s=weixin&c=member&m=login';
        if ($_GET['url']) {
            $burl = urlencode($_GET['url']);
        } else {
            $burl = urlencode((!$this->is_mobile ? SITE_URL : SITE_MURL).'index.php?s=member');
        }
        dr_redirect('https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$this->weixin['account']['appid'].'&redirect_uri='.urlencode($url).'&response_type=code&scope=snsapi_userinfo&state='.($burl).'#wechat_redirect');
    }

}
